Scale Your Automation Testing with AI

  • CheckRun end-to-end parallel tests & reduce test execution time by 5x
  • CheckGenerate tests scripts using natural language with KaneAI
  • CheckAccelerate your testing process with Autoheal, SmartWait & RCA
...
  • Automation
  • Home
  • /
  • Learning Hub
  • /
  • How to Install Playwright: A Comprehensive Guide for 2026

How to Install Playwright: A Comprehensive Guide for 2026

Learn how to install Playwright with this step-by-step guide. Covers setup, install commands, and troubleshooting tips to kickstart end-to-end testing.

Last Modified on: November 18, 2025

  • Share:

Whether you're just starting with end-to-end testing or migrating from other automation testing tools, this step-by-step guide will help you install Playwright framework to get started.

Overview

What Is Playwright?

Playwright is an open-source framework for fast, reliable end-to-end web testing across browsers, with support for multiple languages and advanced automation features.

How to Install Playwright Using Command Line?

Installing Playwright via the command line is quick and straightforward. It allows you to set up the framework directly from your terminal and get started with browser automation in minutes.

  • Initialize a Node.js Project: Start a new Node.js project using the command npm init -y to manage dependencies and prepare your workspace for Playwright tests.
  • Install Playwright: Add Playwright to your project using the command npm install -D playwright to enable browser automation and testing scripts.
  • Install Browser Binaries: Download necessary browser binaries with npx playwright install so Playwright can run tests across Chromium, Firefox, and WebKit reliably.
  • Run the Tests: Execute your Playwright tests using npx playwright test to verify that scripts function correctly across all configured browsers.

How to Install Playwright Using VS Code?

Installing Playwright through Visual Studio Code provides a more interactive and user-friendly setup. You can configure browsers, select your preferred language, and add sample tests directly within the editor, streamlining the testing workflow without leaving VS Code.

  • Open VS Code and Create a Project Folder: Start by opening Visual Studio Code and creating a new folder for your Playwright project.
  • Initialize Playwright Project: Open the terminal in VS Code and run npm init playwright@latest to set up the project.
  • Follow Configuration Prompts: Choose your preferred language, select browsers, and configure other settings as prompted by the setup wizard.
  • Install Playwright Test Extension: If suggested, install the Playwright Test VS Code extension to integrate testing features directly into your editor.
  • Write and Run Tests: You can write tests in VS Code and execute them directly, or run npx playwright test in the terminal.

What Steps Are Necessary to Configure Playwright After Installation?

After installing Playwright, a few configuration steps help ensure your environment, browsers, and project structure are ready for reliable testing.

  • Generate Playwright Config File: If a configuration file is missing, run npx playwright init to create default project settings.
  • Install or Reinstall Browser Binaries: Use npx playwright install or specific commands to ensure required browsers are available for tests.
  • Enable UI Test Runner (Optional): Run npx playwright test --ui to visually inspect, debug, and trace Playwright test executions.
  • Run Sample Test to Verify Setup: Execute npx playwright test to confirm that all scripts and browser binaries are functioning correctly.
  • Configure Project Structure & Test Folder: Adjust test directories, naming conventions, and environment settings within playwright.config.ts or playwright.config.js.

What Is Playwright?

Playwright is an open-source browser automation framework built by Microsoft. It lets you write end-to-end tests for web applications using a single API that works across Chromium, Firefox, and WebKit. You can use Playwright with JavaScript, TypeScript, Python, Java, and .NET.

It has built-in reliability features like auto-wait, trace viewer, and browser context isolation. Playwright also supports headless and headed modes, parallel execution, and full CI/CD integration. This makes it a solid choice for developers and QA engineers working in fast-paced teams.

If you want to learn more and get hands-on with Playwright, follow the Playwright tutorial, this guide will walk you through everything you need to get started quickly, even if you're new to browser automation.

How to Install Playwright?

Installing Playwright isn’t just about running a command, it’s about understanding what’s required, why each step matters, and how the setup leads to real browser automation. A good installation approach helps you prepare your development environment, ensures system compatibility, and sets you up to write and execute tests without confusion.

What Are the Prerequisites for Installing Playwright?

Before installing Playwright, make sure you have a few things in place.

System Requirements:

  • Node.js Version: Requires Node.js 18 or higher along with npm, which comes bundled with Node.js for smooth installation.
  • Operating System Support: Works on Windows 10+, macOS 12+, and Ubuntu 20.04+ ensuring reliable execution across modern platforms.
  • Storage Requirement: Needs at least 2GB of free disk space for downloading and running browser binaries.
  • Editor Recommendation (Optional): Visual Studio Code is recommended for easier debugging, file navigation, and project development.
  • Additional Tooling Support: Git helps with version control and CI workflows, and Python, Java or .NET environments may be required when using those specific Playwright language bindings.

How to Install Playwright via Command Line?

Installing Playwright via CLI is quick and developer-friendly, allowing you to set up the framework directly from the terminal with minimal steps. With a simple Playwright install command, you can pull in the core package and be ready to run automated tests within minutes.

This method is best if you're setting up Playwright from scratch or want full control over your environment.

  • Initialize a New Project: Set up a Playwright project with configuration, sample tests, and browser binaries ready for use.
  • npm init playwright@latest

    If you are using yarn, run the given command below:

    yarn create playwright

    Or using pnpm, run the given command below:

    pnpm create playwright

    You will be prompted to choose a language (JavaScript or TypeScript), a test folder, and whether to install recommended browsers and GitHub Actions config.

    Once completed, you will get a Playwright config file, sample tests, and installed browser binaries.

  • Run a Sample Test: Execute the example test in headless mode using the command below.
  • npx playwright test

    To watch the browser in action, run the given command below:

    npx playwright test --headed
  • Use the Interactive Test Runner: Inspect traces, debug failures, and run tests using a visual interface with:
  • npx playwright test --ui
Note

Note: Run Playwright tests across 50+ real desktop browsers . Try LambdaTest Today!

How to Install Playwright in VS Code ?

Installing Playwright in Visual Studio Code provides a more interactive and user-friendly way to set up your testing environment. With the dedicated VS Code extension, you can configure browsers, choose your preferred language, and add sample tests, all without leaving the editor.

  • Install Playwright Test for VSCode: Add the official Microsoft extension via the Extensions tab to enable Playwright support and access the install button directly in VS Code.
  • Playwright install button on VS Code
  • Open an Empty Folder and Run Install Playwright Command: Open a folder in VS Code, then launch the command palette (Ctrl+Shift+P or Cmd+Shift+P) and search for “Install Playwright.”
  • Install Playwright command
  • Follow the Prompts: The extension will guide you to choose browsers (Chromium, Firefox, WebKit), select JavaScript or TypeScript, add sample tests, and optionally set up GitHub Actions.
  • Install Playwright browsers
  • Run or Debug Tests: After setup, you can use VS Code and Playwright to run tests or debug them directly from the sidebar using the green play and debug icons. The extension also supports Trace Viewer and displays test output logs.
  • Play icon to run Playwright tests in VS code

You can also check out this video tutorial on setting up Playwright by Koushik Chatterjee. He is a Founder of LetCode and Senior Software Test Automation Engineer. Koushik brings close to 10 years of experience in test automation, specializing in building reliable frameworks and driving quality at scale.

How to Install Playwright on Other Languages?

Playwright is not limited to JavaScript and TypeScript; it also supports Python, Java, and .NET, making it versatile across different development environments.

Installing Playwright on these platforms allows you to write end-to-end tests in your preferred language while leveraging the same reliable browser automation features.

Each language has its own package manager and setup process, but the core concepts, browser support, and automation capabilities remain consistent. This enables teams to integrate Playwright into existing projects and CI/CD pipelines seamlessly.

For JavaScript:

Playwright JavaScript is one of the most common ways to run end to end tests. You can install Playwright using npm or yarn, and once installed, you may run npx playwright install to download browser binaries and start writing test scripts instantly.

npm i -D @playwright/test
npx playwright install 

Playwright JavaScript provides fast automation and integrates smoothly with frameworks like Jest, Mocha, and CI pipelines.

For TypeScript:

Playwright works seamlessly with TypeScript, offering type-safety and better IntelliSense for end-to-end testing. You can install Playwright using npm or yarn, then run npx playwright install to download the required browser binaries before writing tests.

npm i -D @playwright/test typescript ts-node
npx playwright install 

Playwright TypeScript enables scalable end-to-end testing with cleaner code, better predictability, and powerful developer tooling support.

For Python:

Playwright Python is widely used for reliable end to end testing. You can install Playwright via pip and then execute the playwright install command to download browser binaries and begin writing tests quickly.

pip install playwright
playwright install 

Playwright Test framework combines with Python’s simplicity for end-to-end testing, and to get started you can follow a Playwright Python tutorial.

For Java:

Playwright Java offers strong cross browser automation support. You can install Playwright by adding its Maven dependency, making it easy to manage builds and run tests within Java based frameworks.

<dependency>
    <groupId>com.microsoft.playwright</groupId>
    <artifactId>playwright</artifactId>
    <version>1.17.0</version>
</dependency> 

Once the dependency is added, generate the browser binaries using:

playwright install

Playwright Java enables fast UI testing with strong type safety and easy integration into enterprise CI/CD workflows.

For .NET:

With Playwright .NET you can automate end to end tests across multiple browsers. Use NuGet to install Playwright, then run the playwright install command to set up necessary browser binaries for execution.

dotnet add package Microsoft.Playwright
playwright install 

Playwright .NET integrates cleanly with MSTest, NUnit, and xUnit for smooth debugging, parallel execution, and seamless test automation.

Why Test Playwright Scripts on Real Browsers?

To ensure your Playwright tests behave as expected in real-world usage, it's important to run them on actual browsers rather than relying solely on headless mode or local execution. Real browser testing helps expose browser-specific rendering differences, performance variations, and compatibility issues that emulation alone may not uncover.

A cloud-based platform allows you to run Playwright tests on real browsers, eliminating the need to manage local browser environments while ensuring accurate cross-browser testing. One such platform is LambdaTest.

LambdaTest is an automation testing platform that allows you to perform both manual and automated Playwright testing at scale across 3000+ browser and OS combinations.

It provides an easy and scalable way to execute Playwright tests on real browsers hosted in the cloud. Instead of maintaining local environments or downloading browser binaries manually, you can run your tests directly on Chrome, Firefox, Edge, and multiple browser versions using LambdaTest’s cloud grid.

By testing Playwright scripts on LambdaTest, teams can identify browser-specific issues early, ensure reliable cross-browser compatibility, and ship applications with higher confidence, all without the overhead of managing their own infrastructure.

...

To get started, check out this guide on Playwright testing with LambdaTest.

Troubleshooting Common Playwright Installation Issues

Troubleshooting Playwright installation issues is often simple once you know where problems typically occur. Most errors stem from missing dependencies, blocked scripts, or browser binaries failing to download.

Below are the most common installation problems and how to resolve them quickly.

  • PowerShell Execution Policy Error: If you see the message "File cannot be loaded because running scripts is disabled", it means PowerShell is blocking script execution. Run the setup using the following command or use Command Prompt instead:
  • powershell -ExecutionPolicy Bypass -Command "npm init playwright@latest"
    
  • Node or npm Not Recognized: This occurs when Node.js is not installed correctly or not detected in PATH. Confirm installation using the commands below:
  • node -v
    npm -v
    

    Restart your terminal if versions still do not appear.

  • Browsers Not Installed: If tests fail because browsers are missing, manually install Playwright browsers:
  • npx playwright install
    
  • npx playwright Install Not Found: This typically indicates Playwright isn’t installed in the project. Ensure local installation instead of global usage to avoid path issues.
  • Unable to Verify the First Certificate: Common in corporate environments with strict SSL validation. Use this temporary workaround only if necessary:
  • export NODE_TLS_REJECT_UNAUTHORIZED=0
    
  • Errors in CI Environments (Vercel, Netlify, etc.): Some CI platforms block full browser packages. Install only the required browser manually if needed:
  • npx playwright install chromium
    

What Should You Configure After Installing Playwright?

After installing Playwright, a few quick configurations help prepare your environment for smooth testing and debugging.

The steps below ensure you have browsers, config settings, and optional UI tooling ready to use.

  • Generate Playwright Config File: Playwright automatically creates a config during project setup, but if missing, generate one manually:
  • npx playwright init 
  • Install or Reinstall Browser Binaries: If you skipped browser installation initially or need only specific browsers, install them using:
  • npx playwright install
    npx playwright install chromium
    npx playwright install firefox
    npx playwright install webkit 
  • Enable UI Test Runner (Optional): Use the Playwright UI mode to visually inspect tests, debug flows, and view traces:
  • npx playwright test --ui 
  • Run Sample Test to Verify Setup: Confirm everything works correctly by executing the default example test suite:
  •  npx playwright test 
  • Configure Project Structure & Test Folder: You may customize your test directory, naming conventions, and environment settings within playwright.config.ts or playwright.config.js.

Conclusion

Installing and configuring Playwright properly is the first step toward building reliable, scalable end-to-end tests across multiple browsers and platforms. By following this guide, you can set up Playwright on JavaScript, TypeScript, Python, Java, and .NET, handle common installation issues, and leverage both local and cloud-based browser testing environments like LambdaTest.

With the post-installation configurations, interactive test runner, and cloud execution options, teams can catch browser-specific issues early, ensure cross-browser compatibility, and accelerate their testing workflows. Whether you are just starting with automation or scaling tests in a CI/CD pipeline, Playwright provides a robust and versatile solution for modern web application testing.

Start experimenting with Playwright today, run your first tests, and take advantage of real-browser testing to deliver high-quality web experiences with confidence.

Citations

Frequently Asked Questions (FAQs)

How to install Playwright on Windows?
Install Node.js (v18+) first. Open Command Prompt or PowerShell, initialize a project with npm init playwright@latest, follow the prompts to select language and browsers, then run npx playwright install to download browser binaries and set up the environment for testing.
How to install Playwright on Mac?
Ensure macOS 12+ and Node.js 18+ are installed. Use Terminal to initialize a project (npm init playwright@latest) or install Playwright locally via npm install -D playwright. Follow prompts and execute npx playwright install to download browser binaries for testing.
How do I install Playwright Stealth?
Playwright Stealth can be installed via npm using npm install playwright-extra and npm install playwright-extra-plugin-stealth. Then import the plugin in your scripts to bypass bot detection and add stealth functionality to your automated browser sessions.
Should I install Playwright globally or locally, and is the same command used for both installations?
It’s recommended to install Playwright locally in the project to avoid version conflicts. Local installation uses npm install -D playwright. Global installation is possible but not advised. The commands differ slightly, with -g for global installs.
How do I install Playwright and a browser on Fedora?
Install Node.js (v18+) via DNF. Initialize a project with npm init playwright@latest or npm install -D playwright. Then run npx playwright install to download Chromium, Firefox, and WebKit browser binaries for automated testing.
How do I install Playwright without affecting my Node 14 environment?
Use Node Version Manager (nvm) to create a separate Node.js v18+ environment. Switch to it and install Playwright locally via npm install -D playwright. This avoids conflicts with your existing Node 14 setup while allowing modern browser automation.
Should I run PLAYWRIGHT_BROWSERS_PATH=0 before running pip install playwright?
Yes, setting PLAYWRIGHT_BROWSERS_PATH=0 ensures that browser binaries are installed in the default local project folder rather than globally. This is especially useful in virtual environments or CI pipelines to prevent permission or path conflicts during Python Playwright installation.
How do I install Playwright with Chromium using sudo apt install node-playwright?
On Debian-based Linux, sudo apt install node-playwright installs the Playwright package with Chromium. For other browsers, use npx playwright install firefox or npx playwright install webkit after installation to complete your setup.
How do I install Playwright-extra using pip?
Install Playwright-extra in Python by running pip install playwright-extra along with any stealth plugins (pip install playwright-extra-plugin-stealth). Then import the modules in your Python scripts to extend Playwright functionality beyond the default API.
Do I still need to install Playwright if I'm using MCP?
Yes, you need Playwright installed because MCP (Managed Cloud Platform) may provide infrastructure or orchestration but does not include the local Playwright library or browser binaries required to execute tests within your project.

Did you find this page helpful?

Helpful

NotHelpful

More Related Hubs

ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!